﻿package com.fatgirl.baseUI.visual
{

	import flash.display.Shape;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import com.fatgirl.baseUI.ILabelButton;

	/**
	 * 标签型按钮基类 
	 * 文字为动态添加，背景容器需要可视化设置
	 * 针对可视化编程
	 * @author iceman
	 * 
	 */
	public class VLabelButton extends VButton implements ILabelButton
	{

		
		private var m_lable:String;
		private var m_lable_tf:TextField;
		public function VLabelButton()
		{
			super();
		}

		public function get label():String
		{
			return m_lable;
		}

		public function set label(value:String):void
		{
			m_lable = value;
			if(m_lable_tf) removeChild(m_lable_tf);
			if(value!=null && value!="")
			{
				if(!m_lable_tf) m_lable_tf = new TextField;
				m_lable_tf.multiline = true;
				m_lable_tf.htmlText = "";
				m_lable_tf.htmlText = value;
				m_lable_tf.x = 0;
				m_lable_tf.y = 0;
				m_lable_tf.width = this.width;
				m_lable_tf.height = this.height;
				m_lable_tf.autoSize = TextFieldAutoSize.CENTER;
				m_lable_tf.y = (this.height - m_lable_tf.height)/2;
				addChild(m_lable_tf);
			}
		}
		public function getLableText():TextField
		{
			return m_lable_tf;
		}
		
		
	}
}